package com.kele.service.impl;

import com.kele.entity.Files;
import com.kele.mapper.FileMapper;
import com.kele.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Version 2019
 * @Author:kele
 * @Date:2021/4/19
 * @Content:
 * @Description：
 */
@Service
public class FileServiceImpl implements FileService {

    @Autowired
    private FileMapper fileMapper;

    @Override
    public List<Files> getAllFiles() {
        List<Files> allFiles = fileMapper.getAllFiles();
        if (allFiles != null)
            System.out.println("查询成功");
        else
            System.out.println("查询失败");
        return allFiles;
    }

    @Override
    public boolean addFile(Files files) {
        boolean isSuccess = false;
        isSuccess = fileMapper.addFile(files);
        if (isSuccess)
            System.out.println("插入成功");
        else
            System.out.println("插入失败");
        return isSuccess;
    }

    @Override
    public Files findById(Integer id) {
        return fileMapper.findById(id);
    }
    @Override
    public List<Files> getFileByFileName(String file_name) {
        List<Files> list = fileMapper.getFileByFileName(file_name);
        return list;
    }

    @Override
    public List<Files> queryByKeyWord(String file_name) {
        List<Files> filesList = fileMapper.queryByKeyWord(file_name);
        return filesList;
    }
}
